import { useLocation } from "react-router-dom"

export default function Detail(){

    // 使用 useLication 可以获得 state 参数
    const location = useLocation()
    // location 中有 state 属性，值即为 state 参数对象
    const { state: {id, title, message}} = location

    return (
        <ul>
            <li>message_id: {id}</li>
            <li>message_title: {title}</li>
            <li>message_content: {message}</li>
        </ul>
    )
}